package com.bs.teachassistant.common;

import android.app.Application;
import android.content.Context;

import com.hjq.toast.ToastUtils;
import com.hjq.toast.style.BaseToastStyle;

import org.xutils.x;

public class AppConfig extends Application {
    private static AppConfig appConfig;

    @Override
    public void onCreate() {
        super.onCreate();
        x.Ext.init(this);
        ToastUtils.init(this, new MyToastStyle(this));
    }

    public static AppConfig getAppConfig() {
        if (null == appConfig)
            appConfig = new AppConfig();
        return appConfig;
    }

    private static class MyToastStyle extends BaseToastStyle {
        MyToastStyle(Context context) {
            super(context);
        }

        @Override
        public int getZ() {
            return 0;
        }

        @Override
        public int getCornerRadius() {
            return dp2px(4);
        }

        @Override
        public int getBackgroundColor() {
            return 0XFF333333;
        }

        @Override
        public int getTextColor() {
            return 0XFFE3E3E3;
        }

        @Override
        public float getTextSize() {
            return sp2px(16);
        }

        @Override
        public int getPaddingStart() {
            return dp2px(16);
        }

        @Override
        public int getPaddingTop() {
            return dp2px(14);
        }
    }

}
